import Vue from "vue/dist/vue.esm"; // 引入带编译器的版本

console.log(Vue);
new Vue({
  // renderWatcher
  el: "#app",
  data: { msg: "abc" },
  computed: {
    // computedWatcher
    length() {
      debugger;
      return this.msg.length;
    },
  },
  watch: {
    // userWatcher
    msg(value) {
      debugger;
      console.log("msg变了", value);
    },
  },
  methods: {
    update() {
      this.msg += "--";
    },
  },
  render: function (h) {
    let vnode = (
      <div>
        <p>msg: {this.msg}</p>
        <p>length: {this.length}</p>
        <button onClick={this.update}>更新</button>
      </div>
    );
    return vnode;
  },
});
